import request from '@/utils/request'

export function register(data) {
  return request({
    url: '/u/register',
    method: 'post',
    data
  })
}

export function login(data) {
  return request({
    url: '/u/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/u/info',
    method: 'get',
    params: { token }
  })
}

export function getDetails(id) {
  return request({
    url: '/u/info/'+id,
    method: 'get',
  })
}

export function list(pageNum, pageSize) {
  return request({
    url: '/u/list',
    method: 'get',
    params: { pageNum, pageSize }
  })
}

export function search(searchform) {
  return request({
    url: '/u/search',
    method: 'post',
    params: searchform
  })
}

export function update(id,data) {
  return request({
    url: '/u/'+id,
    method: 'post',
    data
  })
}

export function logout() {
  return request({
    url: '/u/logout',
    method: 'post'
  })
}

export function del(id){
  return request({
    url: '/u/del/'+id,
    method: 'get',
  })
}
